using System.Collections.Generic;
using System.IO;
using OneDayModel.Interfaces;
using OneDayModel.Tests.Fits.Fixtures.Definitions;

namespace OneDayModel.Tests.Mocks
{
    public class MockFileSystem : IFileSystem
    {
        readonly List<string> files = new List<string>();

        #region IFileSystem Members

        public string CombinePath(string path, string name)
        {
            return Path.Combine(path, name);
        }

        public bool FolderExists(string path)
        {
            return true;
        }

        public bool CreateFolder(string path)
        {
            return true;
        }

        public bool SaveFile(Stream stream, string fileName)
        {
            files.Add(fileName);

            FileSystemDefinitionFixture fileSystemDefinitionFixture = new FileSystemDefinitionFixture();
            fileSystemDefinitionFixture.RegisterFixture();

            fileSystemDefinitionFixture.Folder = Path.GetDirectoryName(fileName);
            fileSystemDefinitionFixture.FileName = Path.GetFileName(fileName);

            fileSystemDefinitionFixture.execute();

            return true;
        }

        #endregion
    }
}